<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>歌曲列表</title>
    <style>
        h2 {
            width: 500px;
            margin: 10px auto;
            text-align: center;
        }

        ul {
            border: 1px solid;
            min-height: 1em;
            width: 600px;
            margin: 0 auto;
            padding: 0 0 10px;
            text-align: center;
            position: relative;
        }

        li {
            list-style: none;
            display: flex;
            justify-content: space-evenly;
            align-items: center;
        }

        li>span {
            display: block;
            width: 100px;
            text-align: center;
            margin: 5px 0;
        }
        li:first-of-type{
            background-color: #dedddd;
            border-bottom: 1px solid;
            margin-bottom: 10px;
        }
        li:first-of-type>button{
            visibility: hidden;
        }

        .btn {
            text-align: center;
            margin: 10px;
        }
        a{
            text-decoration: none;
            color: brown;
        }
        form{
            position: absolute;
            left: 100%;
            display: flex;
        }
    </style>
</head>

<body>
    <h2>歌曲列表</h2>
    <ul>
        <li>
            <span>歌曲名称</span>
            <span>演唱歌手</span>
            <span>单曲价格</span>
            <button>删除</button>
            <button>修改</button>
        </li>
        <% data.forEach((item,index)=>{%>
            <li>
                <span>
                    <%=item.name%>
                </span>
                <span>
                    <%=item.singer%>
                </span>
                <span>
                    <%=item.price%>
                </span>
                <button><a href="/del/<%=item._id%>">删除</a></button>
                <button><a href="/update?_id=<%=item._id%>">修改</a></button>
            </li>
            <%}) %>
    </ul>
    <div class="btn"><button><a href="/addSong">添加歌曲</a></button></div>

    <script>
        function refreshPage() {
            window.location.reload();
        }
    </script>
</body>

</html>